const path = require("path");

console.log(__filename);
//获取路径的基础名称
console.log(path.basename(__filename));
console.log(path.basename(__filename, ".js"));
console.log(path.basename(__filename, ".css"));

// 目录路径
console.log(path.dirname(__dirname));

// 获取路径扩展名
console.log(path.extname(__filename));

// 解析路径
console.log(path.parse(__filename));
// {
//     root: '/',
//     dir: '/Users/lipengxi/Desktop/lx/lg-study/Part5_Node/2.内置模块',
//     base: 'path.js',
//     ext: '.js',
//     name: 'path'
//   }

// 序列化路径
console.log(path.format(path.parse(__filename)));

//判断当前路径是不是绝对路径
console.log(path.isAbsolute("/a"));

// 拼接路径
console.log(path.join("a/b", "c", "index.html"));

// 规范化路径
console.log(path.normalize("a//c/d"));

//绝对路径
console.log(path.resolve("/a", "b"));
